\(\int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx\) [5]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 27 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=-\frac {i (a+i a \tan (c+d x))^2}{2 a d} \]

[Out]

-1/2*I*(a+I*a*tan(d*x+c))^2/a/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.11, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.136, Rules used = {3567, 3852, 8} \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=\frac {a \tan (c+d x)}{d}+\frac {i a \sec ^2(c+d x)}{2 d} \]

[In]

Int[Sec[c + d*x]^2*(a + I*a*Tan[c + d*x]),x]

[Out]

((I/2)*a*Sec[c + d*x]^2)/d + (a*Tan[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3567

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*((d*Sec[
e + f*x])^m/(f*m)), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {i a \sec ^2(c+d x)}{2 d}+a \int \sec ^2(c+d x) \, dx \\ & = \frac {i a \sec ^2(c+d x)}{2 d}-\frac {a \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d} \\ & = \frac {i a \sec ^2(c+d x)}{2 d}+\frac {a \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.11 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=\frac {i a \sec ^2(c+d x)}{2 d}+\frac {a \tan (c+d x)}{d} \]

[In]

Integrate[Sec[c + d*x]^2*(a + I*a*Tan[c + d*x]),x]

[Out]

((I/2)*a*Sec[c + d*x]^2)/d + (a*Tan[c + d*x])/d

Maple [A] (verified)

Time = 0.62 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.04

method result size
derivativedivides \(-\frac {i a \left (-\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+i \tan \left (d x +c \right )\right )}{d}\) \(28\)
default \(-\frac {i a \left (-\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+i \tan \left (d x +c \right )\right )}{d}\) \(28\)
risch \(\frac {2 i a \left (2 \,{\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}\) \(34\)

[In]

int(sec(d*x+c)^2*(a+I*a*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

-I*a/d*(-1/2*tan(d*x+c)^2+I*tan(d*x+c))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 45 vs. \(2 (21) = 42\).

Time = 0.23 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.67 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=-\frac {2 \, {\left (-2 i \, a e^{\left (2 i \, d x + 2 i \, c\right )} - i \, a\right )}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]

[In]

integrate(sec(d*x+c)^2*(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

-2*(-2*I*a*e^(2*I*d*x + 2*I*c) - I*a)/(d*e^(4*I*d*x + 4*I*c) + 2*d*e^(2*I*d*x + 2*I*c) + d)

Sympy [A] (verification not implemented)

Time = 0.74 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.37 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=\begin {cases} \frac {\frac {i a \tan ^{2}{\left (c + d x \right )}}{2} + a \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (i a \tan {\left (c \right )} + a\right ) \sec ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(sec(d*x+c)**2*(a+I*a*tan(d*x+c)),x)

[Out]

Piecewise(((I*a*tan(c + d*x)**2/2 + a*tan(c + d*x))/d, Ne(d, 0)), (x*(I*a*tan(c) + a)*sec(c)**2, True))

Maxima [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.78 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=-\frac {i \, {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{2}}{2 \, a d} \]

[In]

integrate(sec(d*x+c)^2*(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*I*(I*a*tan(d*x + c) + a)^2/(a*d)

Giac [A] (verification not implemented)

none

Time = 0.38 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.96 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=-\frac {-i \, a \tan \left (d x + c\right )^{2} - 2 \, a \tan \left (d x + c\right )}{2 \, d} \]

[In]

integrate(sec(d*x+c)^2*(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/2*(-I*a*tan(d*x + c)^2 - 2*a*tan(d*x + c))/d

Mupad [B] (verification not implemented)

Time = 3.87 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.85 \[ \int \sec ^2(c+d x) (a+i a \tan (c+d x)) \, dx=\frac {a\,\mathrm {tan}\left (c+d\,x\right )\,\left (2+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}{2\,d} \]

[In]

int((a + a*tan(c + d*x)*1i)/cos(c + d*x)^2,x)

[Out]

(a*tan(c + d*x)*(tan(c + d*x)*1i + 2))/(2*d)